<template>
    <div>
            <input v-model='register_name' type='text' placeholder='老师姓名'><br>
            <input v-model='register_pwd' type='password' placeholder='密码'><br>
            <button @click="register">提交信息</button>
    </div>
</template>
<script>
import axios from 'axios'
export default {
    data(){
        return{
            register_name:'',
            register_pwd:'',
        }

    },
    methods:{
        register(){
            let form_data = new FormData()
            form_data.append('register_name',this.register_name)
            form_data.append('register_pwd',this.register_pwd)
            axios({
                url:'http:127.0.0.1:8000/api/register/',
                method:'post',
                data:form_data,
            }).then(res=>{
                console.log(res.data)
                if(res.data.code==0){
                    this.message = res.data.message
                }else{
                    alert('请登录！')
                }
            })
        }
    }
}
</script>
